package com.springboot.last_experiment.configuration;

/**
 * @author Chb
 * date 2020-06-19
 */
import org.springframework.boot.web.server.ConfigurableWebServerFactory;
import org.springframework.boot.web.server.ErrorPage;
import org.springframework.boot.web.server.WebServerFactoryCustomizer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpStatus;

@Configuration
public class ServletConfig {
  @Bean
  public WebServerFactoryCustomizer<ConfigurableWebServerFactory> webServerFactoryCustomizer() {
    return factory -> {
      ErrorPage errorPage = new ErrorPage(HttpStatus.NOT_FOUND,"/index.html");
      factory.addErrorPages(errorPage);
    };
  }
}
